﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace LastfmNet.Models
{
    public class Session : LastfmModelBase
    {
        public Session()
        {
            this.Name = string.Empty;
            this.Key = string.Empty;
            this.Subscriber = 0;
        }

        public Session(XmlNode sessionNode)
        : this()
        {
            if (sessionNode == null) return;
            this.InitializeFromXmlNode(sessionNode);
        }

        public override void InitializeFromXmlNode(XmlNode node)
        {
            if (node == null) return;
            this.Name = node.GetChildValue("name");
            this.Key = node.GetChildValue("key");
            this.Subscriber = node.GetChildValue("subscriber").ToInteger();
        }

        public string Name { get; set; }

        public string Key { get; set; }

        public int Subscriber { get; set; }
    }
}
